package com.easybuilder.core.rbac.controller;

import com.easybuilder.common.base.controller.BaseController;
import com.easybuilder.common.base.entity.PageQueryWrapper;
import com.easybuilder.common.base.entity.PageResultWrapper;
import com.easybuilder.core.rbac.entity.SysRole;
import com.easybuilder.core.rbac.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @Author zhangxingshuai
 * @Description //TODO 系统角色controller
 * @Date 9:35 2021/8/23
 * @Param
 * @return
 **/
@RestController
@RequestMapping("/sys/role")
public class SysRoleController extends BaseController {
    @Autowired
    private SysRoleService roleService;

    @PostMapping("/page")
    public Result<?> page(PageQueryWrapper<SysRole> pageQueryWrapper){
        PageResultWrapper<SysRole> page = roleService.page(pageQueryWrapper);
        return OK(page);
    }

    /** 增加 */
    @PostMapping("/save")
    public Result<Object> save(@RequestBody SysRole sysRole) {
        if (sysRole == null) {
            return Error(HttpStatus.BAD_REQUEST, "参数异常");
        }
        roleService.save(sysRole);
        return OK("保存成功");
    }

    /** 查询 */


    /** 修改 */

    /** 删除 */
}
